<template>
  <div class="file-search-view">
    <div class="file-search-seach">
      <div class="file-seach">
        <el-input placeholder="请输入内容" v-model="inFileSeach" class="input-with-select">
          <el-button slot="append" @click="findFile">GO</el-button>
        </el-input>
      </div>
    </div>
    <div class="file-search-table">
      <el-table
        :data="tableData"
        height="100%"
        border
        style="width: 100%"
        highlight-current-row
        :header-cell-style="{background:'#eef1f6',color:'#606266'}"
        @row-click="rowClick"
      >
        <el-table-column
          align="center"
          :show-overflow-tooltip="true"
          prop="owner"
          label="文件所有人"
        >
        </el-table-column>
        <el-table-column
          align="center"
          :show-overflow-tooltip="true"
          prop="length"
          label="文件大小"
        >
        </el-table-column>
        <el-table-column
          align="center"
          :show-overflow-tooltip="true"
          prop="modificationTime"
          label="最后修改"
        >
          <template slot-scope="scope">
            {{scope.row.modificationTime | formatDate}}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          :show-overflow-tooltip="true"
          prop="type"
          label="类型"
        >
        </el-table-column>
        <el-table-column
          align="center"
          :show-overflow-tooltip="true"
          prop="pathSuffix"
          label="文件名"
        >
        </el-table-column>
      </el-table>
    </div>
    <div class="file-search-paging">
      <el-pagination
        layout="total, sizes, prev, pager, next"
        background
        :page-size="pageSize"
        :total="total"
        :page-count="10"
        :page-sizes="[5, 10, 20, 40]"
        :current-page="currentPage"
        @current-change="changePage"
        @size-change="sizeChange"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>

  export default {

    components: {},
    name: "fileSearchView",
    props: {
      tableData: {
        type: Array,
        default: []
      },
      total: {
        type: Number,
        default: 10
      },
      pageSize: {
        type: Number,
        default: 10
      },
      currentPage: {
        type: Number,
        default: 1
      },
      fileSeach: {
        type: String,
        default: ""
      }
    },
    filters: {},
    computed: {},
    watch: {
      fileSeach(newValue, oldValue) {
        this.inFileSeach = newValue;
      }
    },
    data() {
      return {
        inFileSeach: this.fileSeach
      }

    },
    created() {
    },
    mounted() {

    },
    methods: {
      // 改变当前页
      changePage(page) {
        this.$emit('changePage', page);
      },
      // 改变每页条数
      sizeChange(num) {
        this.$emit('sizeChange', num);
      },
      // 路径查找
      findFile() {
        this.$emit('findFile', this.inFileSeach);
      },
      // 点击行数据
      rowClick(row) {
        this.$emit("rowClick", row);
      }
    },
    destroyed() {

    }
  }
</script>

<style scoped lang="less">
  @import url("./fileSearch");
</style>
